
Electric Corrections Help


                                          help version: 0.3
                                               created: 10/05/00 {08:43:42 pm}
                                           last update: 04/04/01 {04:52:48 pm}


This extension package for Alpha helps check for and correct spelling
mistakes or typos as you type.  This is not a spell-checking extension --
instead it is more of a "misspell-checker": you must teach Alpha the common
misspellings or typos to correct using the menu items described below.

Whenever you press the return or space key, Alpha will then compare the
previous word to the list of all typos, and correct it if necessary.  This
package also includes a "Smart i" preference, which can automatically
change "i" to "I" as you type.

Activating the extension will create four new preferences and insert a new
"Config --> Packages --> Electric Corrections" submenu described below.
    

	  	Preferences


These preferences appear in the "Config --> Preferences --> Electrics"
menu.  They can also be changed via the "Electric Corrections" menu.

	Smart i

Automatically convert " i " to " I ".  

	Smart i Modes

Allows you to specify the modes that use the "Smart i" feature, initially
including only "Text TeX Bib HTML".  If this list is empty, automatic
correction applies to all modes.

	Turn Corrections On/Off

Turns automatic corrections of typos on or off.  This does not affect the
"Smart i" preference.

	Correcting Modes

Allows you to specify the modes that check for misspellings.  If this list
is empty (the default value), automatic correction applies to all modes.


	  	Electric Corrections Menu


	View Corrections

Open a window with all current typos.  The package only supplies one typo
to initially correct, changing "hte" to "the"

	Add Corrections

Open a dialog to create new typos.  Only lower-case typos need to be
entered -- both lower-case and capitalized typos will be corrected
automatically.

	Edit Corrections

Open a list-pick dialog to edit all typos.

	Remove Corrections

Open a list-pick dialog to remove all user-defined typos.

	Smart i

Automatically convert " i " to " I ".  

(This is a toggleable menu item, turning the preference on and off.)

	Smart i Modes

Allows you to specify the modes that use the "Smart i" preference,
initially including only "Text TeX Bib HTML".  If this list is empty,
automatic correction applies to all modes.

	Turn Corrections On/Off

Turns automatic corrections of misspellings or typos on or off.  This does
not affect the "Smart i" preference.

	Correcting Modes

Allows you to specify the modes that check for typos.  If this list is
empty (the default value), automatic correction applies to all modes.

	Corrections Help

Open this file.
    

	  	Usage


Following every <space> or <return> keystroke, the preceding word is
checked against the list of defined typos -- if the word matches, it is
deleted and the correction is inserted.  If the "Smart i" preference is
set, then any lone i will be converted to I. Preceding words are checked
even if followed by an intermediate character such as , .  ; etc.  -- the
correction is inserted without disturbing the following characters.  So

	Where was i?
	i decided to ask hte, well, obviously oblivious inn-keeper, ...   

corrects to 

	Where was I?
	I decided to ask the, well, obviously oblivious inn-keeper, ...   

All user-defined misspellings/typos are automatically converted to both
lower case and capitalized words -- both "hte --> the" and "Hte --> The"
work, but only the first must be defined.  Note that if you have multiple
misspellings for the same word, you must defined each one separately, such
as "teh --> the".  All typos will be corrected in any mode listed in the
"Correcting Modes" preference -- it is not possible (at least not yet ...) 
to define mode-specific typos.
    

Here's one way to exploit this feature: I have defined the following
"typos", which I generally will not accidentally type:

    "sgy  --> sociology"
    "scal --> sociological"
    "slly --> sociologically"
    "sc   --> social capital"

Now whenever I type "sgy" or "Sgy", the "correction" is automatically
inserted if I follow it with a <space> or <return>.  Suppose that I have
the terms "screaming" and "somethingCruddy" in my file, and I have just
typed "sc".  Note the following electric options:

	<space> or <return>:    correct to      "social capital"
	<completion key>:       complete to     "screaming"
	<expansion key>:        expand to       "somethingCruddy"


If you would like to define "electric corrections over-ride" keys, open a 
"prefs.tcl" file and add these lines:

	Bind '\ ' <s> {insertText "\ "}
	Bind '\r' <s> {bind::CarriageReturn}

Holding down the shift key while pressing <space> or <return> will then
over-ride corrections and simply enter a space or a carriage return.


	  	Possible future directions
    

   Include a pre-defined set of typos that has something more than simply
	"hte".  I would just as soon leave it up to the user to create them,
	but if somebody has a list that they would like to send along (with
	common typos and the corrections, please) I'll include it in future
	versions.  One concern that I have is that for such a list to be truly
	useful, it should be comprehensive, and that will both make it much
	more difficult for the user to know what's in there and potentially
	slow down the correcting process.
    
    Procedures have already been written to unset/restore the default 
    list.  It would be possible to come up with several different lists to 
    accommodate different editing settings, or languages ...
    
   Allow the creation of mode-specific corrections, similarly to
    mode-specific completions.  I don't have any objections, but I'm not
    sure about the best way to accomplish this.
    
Source code can be found in "elecCorrections.tcl" -- contributions are
certainly welcome.


	  	Acknowledgments


This package was inspired by "Electric Completions / Expansions", and based
upon the proc: sql_electUpper found in "sqlMode.tcl" (Joel D. Elkins.) 
Many thanks to Vince Darley and Bernard Desgraupes for several bug fixes
and suggestions.


	  	License and Disclaimer


Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

  Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

  Neither the name of Alpha/Alphatk nor the names of its contributors may
   be used to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

This package is free.  Alpha is shareware ! <<register>>


cheers,

-- Craig


  Author:  Craig Barton Upright
  E-mail:  <cupright@princeton.edu>
    mail:  Princeton University,  Department of Sociology
           Princeton, New Jersey  08544
     www:  <http://www.princeton.edu/~cupright/>

